package cn.itcast.web.task;

import cn.itcast.service.cargo.ExportService;
import com.alibaba.dubbo.config.annotation.Reference;


public class ExportJob {

 @Reference
 private ExportService exportService;

/* *//**
  * 没隔5秒打印时间
  *//*
 public void execute() {
  String time = new SimpleDateFormat("yyyy年MM月dd日 hh:mm:ss").format(new Date());
  System.out.println("当前时间：" + time);
 }*/

 /**
  * 每5秒查询一次
  */
 public void execute() {
  //查询数据库中状态=2的所有报运单
 /* ExportExample example = new ExportExample();
  ExportExample.Criteria criteria = example.createCriteria();
  criteria.andStateEqualTo(2l);
  List<Export> list = exportService.findAll(example);
  //循环所有商品对象，调用海关平台获取数据响应
  for (Export export : list) {
   WebClient wc = WebClient.create("http://localhost:9001/ws/export/ep/" + export.getId());
   ExportResult result = wc.get(ExportResult.class);
   //判断保运状态
   if (result.getState() != 2) {
    exportService.updateE(result);
   }
  }*/
 }
}
